<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
use app\models\FeeItem;
/* @var $form yii\widgets\ActiveForm */
?>

<style>
    .col-sm-2 {
        width: 30%;
    }

    .control-label {
        text-align: left !important;
    }

    .col-md-10 {
        width: 65%;
    }

    table#other_fee_table th{
        padding-left:0px;
    }

    table#other_fee_table td{
        padding:0px 5px 0px 0px;
    }

    .col-md-offset-2 {
        margin-left:25%;
    }

    .form-group {
        margin-bottom: 5px;
    }
</style>

<script>
    function submitForm($form) {
        $.post(
                $form.attr("action"), // serialize Yii2 form
                $form.serialize()
            )
            .done(function(result) {
                //$form.parent().html(result.message);
                // $('#modal').modal('hide');

                console.log("post success");
            })
            .fail(function() {
                console.log("server error");
                //$form.replaceWith('<button class="newType">Fail</button>').fadeOut()
            });

        return false;
    }

</script>


<div class="user-form">

    <?php $form = ActiveForm::begin([
        'id' => 'my-form-user',
        'beforeSubmit' => 'submitForm',
    ]); ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => 50]) ?>
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
